#!/usr/bin/python 

import sys
import time

sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code/")
sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_I2C")
sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_MCP230xx")

from Adafruit_I2C import Adafruit_I2C
from Adafruit_MCP230xx import Adafruit_MCP230XX

mcp = Adafruit_MCP230XX(address = 0x20, num_gpios = 16)

OUTPUT = 0

mcp.config(4, OUTPUT)
mcp.config(5, OUTPUT)
mcp.config(6, OUTPUT)
mcp.config(7, OUTPUT)
mcp.config(8, OUTPUT)
mcp.config(9, OUTPUT)

hw_resource = {
    "Csepegteto":7,
    "Hatul":6,
    "Oldalt":5,
    "A": 8,
    "B": 9
    }

def on(hwid):
    try:
        mcp.output(hw_resource[hwid],1)
    except:
        print "Invalid HWID", hwid

def off(hwid):
    try:
        mcp.output(hw_resource[hwid],0)
    except:
        print "Invalid HWID", hwid
    

"""
#mcp.outputAll(1)

while(True):
   mcp.output(8,1)

   time.sleep(0.1) 

   mcp.output(8,0)

   time.sleep(0.1)
"""

